﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="copy.aspx.cs" Inherits="He.Web.manage.tools.copy" %>

<%@ Register Src="../_uc/head.ascx" TagPrefix="uc" TagName="head" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>数据对拷</title>
    <uc:head runat="server" ID="uchead" />
    <style type="text/css">
        .msg
        {
            color: Red;
            font-weight: bold;
        }
    </style>
    <script type="text/javascript">
        function checkProgress() {
            $.ajax({
                type: "get",
                url: "../../tools/progress_ajax.ashx?act=check_copy&threadKey=<%=threadKey %>&" + Math.random(),
                dataType: "json",
                success: function (data) {
                    if (data.msg == "1" && data.msgbox != "") {
                        $(".msg").html(data.msgbox);
                    }
                },
                error: function (data, status, e) { }
            });
        }
        var timer = setInterval("checkProgress()", 500);

        function removeCache() {
            checkProgress();
            $.ajax({
                type: "get",
                url: "../../tools/progress_ajax.ashx?act=remove_cache&threadKey=<%=threadKey %>"
            })
        }

        $(function () {
            //拷贝分类
            $.ajax({
                type: "post",
                url: "../../tools/data_copy.ashx?act=<%=action %>&threadKey=<%=threadKey %>&copy_all=<%=copy_all %>&copy_child=<%=copy_child %>&is_translate=<%=is_translate %>&clear_tags=<%=clear_tags %>&make_thumb=<%=make_thumb %>&img_width=<%=img_width %>&FromChannelId=<%=fromChannelId %>&ToChannelId=<%=toChannelId %>&fromCategoryId=<%=fromCategoryId %>&toCategoryId=<%=toCategoryId %>",
                dataType: "json",
                data: "idlist=<%=idlist %>",
                success: function (data) {
                    $("#loading").hide();
                    //$(".msg").append("<font color='red'> 拷贝结束</font> <a href='javascript:history.go(-1)'>返回拷贝列表</a>");
                    removeCache();
                    clearInterval(timer);
                },
                error: function (data, status, e) {
                    clearInterval(timer);
                    $("#loading").hide();
                    //$(".msg").append("<font color='red'>× 拷贝中出错，拷贝终止</font> <a href='javascript:history.go(-1)'>返回拷贝列表</a>");
                    removeCache();
                }
            })
        })

    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div class="navigation">
        <span class="back"><a href='javascript:(history.go(-1))'>返回列表</a></span> <b>您当前的位置：首页
            &gt; 扩展工具&gt;数据对拷</b>
    </div>
    <div class="spClear">
    </div>
    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="msgtable">
        <tr>
            <td width="50" valign="top" align="right">
                <img id="loading" src="../images/loading.gif" />
            </td>
            <td class="msg" style="line-height: 30px;" valign="top">
                正在准备对拷……
            </td>
        </tr>
    </table>
    </form>
</body>
</html>
